import React, { Component } from 'react'
import { Card, Button, notification } from 'antd'

class Notice extends Component {
    state = {}
    openNotification = (type, direction) => {
        if (direction) {
            notification.config({
                placement: direction,
            });
        }
        notification[type]({
            message: '火警预告',
            description: '火警预告，快跑'
        })
    }
    render() {
        return (
            <div>
                <Card title="通知提示框" className="card-wrap">
                    <Button onClick={() => this.openNotification('info', 'topLeft')}>info</Button>
                    <Button onClick={() => this.openNotification('success', 'topRight')}>success</Button>
                    <Button onClick={() => this.openNotification('warning', 'bottomLeft')}>warning</Button>
                    <Button onClick={() => this.openNotification('error', 'bottomRight')}>error</Button>
                </Card>
            </div>
        )
    }
}

export default Notice;